home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: phalpern@truffle.ultranet.com (Pablo Halpern)
- Newsgroups: comp.std.c++
- Subject: Re: proposal: renew & relocator member fn
- Date: 22 Feb 1996 15:51:17 GMT
- Organization: UltraNet Communications, Inc.
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <4ghtnb$u0u@caesar.ultra.net>
- References: <GNB.96Feb7140952@dame.bby.com.au> <4fgfpu$oth@hermes.synopsys.com>
- NNTP-Posting-Host: taumet.eng.sun.com
- Content-Type: text
- X-Nntp-Posting-Host: truffle.ultranet.com
- X-Newsreader: Forte Agent .99b.113
- Content-Length: 1050
- X-Lines: 31
- Originator: clamage@taumet
-
- jbuck@Synopsys.COM (Joe Buck) wrote:
-
- > [Discussion about need for a special relocation constructor/destructor ]
-
- >Consider the template
- >
- >template<class T>
- >T* relocate(T* oldloc, void* newloc) {
- > T* result = new(newloc) T(*oldloc);
- > oldloc->~T();
- >}
- >
- > [Discussion about how this template be specialized for classes where
- relocation could be made cheaper]
- >
-
- I like this a lot. I wouldn't mind seeing this added to the standard
- library and used in the implementation of STL.
-
- It doesn't solve one problem that realloc() does solve: the ability to
- prevent relocation if the allocator is able to grow a block without
- relocating it. I believe run-time library support tied to a language
- extension is needed if you are to take advantage of an operating-system
- capability like that. We can probably live without such a language
- extension.
- -------------------------------------------------------------
- Pablo Halpern phalpern@truffle.ultranet.com
-
- I am self-employed. Therefore, my opinions *do* represent
- those of my employer.
-
-
- [ To submit articles: Try just posting with your newsreader.
- If that fails, use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-